home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / zmdm / zmdm.h < prev    next >
C/C++ Source or Header  |  1993-06-26  |  5KB  |  183 lines

  1. /*
  2.  *     Common include file
  3.  *
  4.  *        Jwahar Bammi
  5.  *            usenet: cwruecmp!bammi@decvax.UUCP
  6.  *            csnet:  bammi@cwru.edu
  7.  *            arpa:   bammi@cwru.edu
  8.  *            CompuServe: 71515,155
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include <ctype.h>
  13. #include <setjmp.h>
  14. #include <osbind.h>
  15. #include "decl.h"
  16.  
  17.     /* See configurable parameters towards the end of the file */
  18.     /* Leave the rest alone                      */
  19.  
  20.  
  21.     
  22.      /* Common defines */
  23. #ifndef FALSE
  24. #define    FALSE         0
  25. #define TRUE         1
  26. #endif
  27.  
  28.  
  29. #define EscSeq(x)    Bconout(2,(int)'\033'); Bconout(2,(int)x) /* Send Esc.
  30.                             Seq. to     console */
  31. #define CTRL(X)        (X & 037) /* CTRL-anything */
  32.  
  33. #define STOS      "GEMDOS/TOS"
  34. #define ZMDMVERSION    "1.2 -- 07/25/87"
  35.  
  36. #define IBUFSIZ        16*1024    /* Size of my Rs232 receive buffer */
  37.  
  38. /* Ward Christensen / CP/M parameters - Don't change these! */
  39. #define ENQ 005
  40. #define CAN ('X'&037)
  41. #define XOFF ('s'&037)
  42. #define XON ('q'&037)
  43. #define SOH 1
  44. #define STX 2
  45. #define EOT 4
  46. #define ACK 6
  47. #define NAK 025
  48. #define CPMEOF 032
  49. #define WANTCRC 0103    /* send C not NAK to get crc not checksum */
  50. #define TIMEOUT (-2)
  51. #define RCDO (-3)
  52. #define ERRORMAX 5
  53. #define RETRYMAX 10    /* for dogs like compuserve */
  54. #define WCEOT (-10)
  55. #define SECSIZ 128    /* cp/m's Magic Number record size */
  56. #define PATHLEN 128    /* ready for 4.2 bsd ? noooooo */
  57. #define KSIZE 1024    /* record size with k option */
  58. #define UNIXFILE 0x8000    /* happens to the the S_IFREG file mask bit for stat */
  59. #define DEFBYTL 2000000000L    /* default rx file size */
  60. #define WANTG 0107    /* Send G not NAK to get nonstop batch xmsn */
  61.  
  62. #define PURGELINE    while(Bconstat(1))Bconin(1);Lleft = 0
  63.  
  64. #define RLOGFILE "rzlog"
  65. #define zperr vfile
  66. #define zperr2 vfile2
  67.  
  68. #define OK 0
  69. #define ERROR (-1)
  70. #define HOWMANY 133
  71. /* Parameters for ZSINIT frame */
  72. #define ZATTNLEN 32    /* Max length of attention string */
  73.  
  74.      
  75.      /* Types */
  76.  
  77. #ifdef LONG
  78. #undef LONG    /* Get rid of stupid portab.h definition */
  79. #endif
  80.  
  81. #ifdef WORD
  82. #undef WORD
  83. #endif
  84.  
  85. #ifdef UWORD
  86. #undef UWORD
  87. #endif
  88.  
  89. struct    stat
  90. {
  91.     char    st_sp1[21];    /* Junk        */
  92.     char    st_mode;       /* File attributes */
  93.     int    st_time;       /* Mod Time      */
  94.     int     st_date;       /* Mod date      */
  95.     long    st_size;       /* File size       */
  96.     char    st_name[14];   /* File name       */
  97. };
  98.  
  99. /* The structure returned by Iorec(), really ptr to this type */
  100. typedef struct {
  101.     char *ibuf;
  102.     int ibufsiz;
  103.     int ibufhd;
  104.     int ibuftl;
  105.     int ibuflow;
  106.     int ibufhi;
  107. } IOREC;
  108.  
  109. /*
  110.  * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. 
  111.  *  NOTE: First srgument must be in range 0 to 255.
  112.  *        Second argument is referenced twice.
  113.  * 
  114.  * Programmers may incorporate any or all code into their programs, 
  115.  * giving proper credit within the source. Publication of the 
  116.  * source routines is permitted so long as proper credit is given 
  117.  * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, 
  118.  * Omen Technology.
  119.  */
  120. #ifndef IN_COMMON
  121. extern unsigned int crctab[]; /* see definition in common.c */
  122. extern unsigned long int crc_32_tab[]; /* see definition in common.c */
  123. #endif
  124.  
  125. #define updcrc(cp, crc) \
  126. ( crctab[(((unsigned int)crc >> 8) & 255)] ^ ((unsigned int)crc << 8) ^ (unsigned int)cp)
  127.  
  128. #define UPDC32(octet, crc) \
  129. (crc_32_tab[(((unsigned long)crc) ^ ((unsigned long)octet)) & 0xff] ^ (((unsigned long)crc) >> 8))
  130.  
  131.  
  132. /*****************************************************************************\
  133. *                                          *
  134. *           CONFIGURABLE  STUFF  BEGINS  HERE                  *
  135. *                                          *
  136. \*****************************************************************************/
  137.  
  138.  
  139.  
  140. /*****************************************************************************\
  141. *                                          *
  142. *        Set up the following to satisfy your personal fancies          *
  143. *                                          *
  144. \*****************************************************************************/
  145.  
  146.  
  147. /* ------------------------------------------------------------------------*/
  148. /* Uncomment one of the following */
  149.  
  150. #define BAUD_DEFAULT    1         /* for 9600 Baud - see rsconf() */
  151. #define BAUD_STRING    "9600"      /* String for Baud rate     */
  152. #define BAUD_RATE       9600        /* the integer             */
  153.  
  154. /* #define BAUD_DEFAULT    7 */        /*  for 1200 Baud - see rsconf() */
  155. /* #define BAUD_STRING    "1200" */   /*  String for Baud rate        */
  156. /* #define BAUD_RATE    1200   */ /* the integer            */
  157.  
  158. /* ------------------------------------------------------------------------*/
  159.  
  160. /*
  161.  * Do flow control while doing terminal emulation -
  162.  * this only needs to be defined if you are
  163.  * going to be running Zmdm at 19200 Baud and
  164.  * you are going to be sending it (from the host)
  165.  * greater that 16k characters in one blast, without
  166.  * any pause whatsoever. For 99.95 % of us mortals
  167.  * this will never be required. Even if it is defined
  168.  * its no big deal, as flow control will not happen
  169.  * unless the condition described above exists.
  170.  * NOTE: flow control is turned off during file transfers.
  171.  */
  172. /* #define FLOW_CTRL    1 */    /* do flow control */
  173.  
  174. #define BBUFSIZ        32768L        /* Size of file/capture buffer */
  175.  
  176. /*****************************************************************************\
  177. *                                          *
  178. *            End of configurable parameters                  *
  179. *                                          *
  180. \*****************************************************************************/
  181.  
  182. /** EOF **/
  183.